<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>学生教师管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/dp01.css">
    <link rel="stylesheet" href="/css/dp02.css">
    <style>
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">主管理页面</div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
            <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 1</a></li>
            <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 2</a></li>
            <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 3</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">nav groups</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">menu 11</a></dd>
                    <dd><a href="javascript:;">menu 22</a></dd>
                    <dd><a href="javascript:;">menu 33</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a href="javascript:;">
                    <img src="//unpkg.com/outeres@0.0.10/img/layui/icon-v2.png" class="layui-nav-img">
                    tester
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">Your Profile</a></dd>
                    <dd><a href="javascript:;">Settings</a></dd>
                    <dd><a href="javascript:;">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">管理页面</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/student/list">学生管理页面</a></dd>
                        <dd><a href="/teacher/list">教师管理页面</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">

            <div class="layui-card layui-panel" id="content">
                <!-- 内容将被加载到这里 -->
            </div>
            <br><br>
        </div>
    </div>
    <br><br>
</div>
</div>
<div class="layui-footer">
    <!-- 底部固定区域 -->
    底部固定区域
</div>
</div>

<script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
<script>
    layui.use(['jquery', 'element'], function(){
        var $ = layui.jquery;
        var element = layui.element;

        // 使用事件委托绑定点击事件
        $(document).on('click', '.layui-nav-item a', function(){
            var url = $(this).attr('href');
            openInIframe(url);
            return false; // 阻止默认的链接跳转
        });

        // 定义 openInIframe 函数，用于在 layui-body 中打开不同的页面
        function openInIframe(url) {
            // 使用 AJAX 获取页面内容
            $.get(url, function(data){
                // 将获取到的内容插入到 #content 中
                $('#content').html(data);
                // 重新初始化layui组件
                element.init();
                // 重新绑定事件
                bindEvents();
            });
        }

        function bindEvents() {
            $('#content').on('click', '.addTeacher, .editTeacher', function(e) {
                e.stopPropagation(); // 阻止事件冒泡
                // 你的编辑或新增逻辑
                console.log('Button clicked');
            });

        }

        bindEvents();
    });
    layer.closeAll();
</script>
<style>
    .layui-layer-shade{
        display: none;
    }
</style>
</body>
</html>